package cn.green.core.adapt.comps.field.type;

import cn.green.core.components.database.session.dml.DeleteSession;
import cn.green.core.components.database.session.dml.InsertSession;
import cn.green.core.components.database.session.dml.UpdateSession;
import cn.green.core.model.QFieldModel;
import cn.green.core.model.QTableModel;
import cn.green.core.scanner.anno.comps.QTableComponent;
import com.alibaba.fastjson.JSONObject;

import java.util.List;

/**
 * @author wang.yishu
 * @version 1.0
 * @className RelevantOneToOneType
 * @description 关联一对一，与普通一对一相比关联一对一可以再主表做增删改的同时维护一对一表
 * @date 2025/7/24 14:29
 */
@QTableComponent
public class RelevantOneToOneType extends OneToOneType {

    @Override
    public String fieldTypeName() {
        return "REV_ONE_TO_ONE";
    }

    @Override
    public String fieldTypeCode() {
        return "REV_ONE_TO_ONE";
    }

    @Override
    public InsertSession insertSession(QTableModel table, QFieldModel field, JSONObject record) {
        return super.insertSession(table, field, record);
    }

    @Override
    public UpdateSession updateSession(QTableModel table, QFieldModel field, JSONObject record, List<String> conditions) {
        return super.updateSession(table, field, record, conditions);
    }

    @Override
    public DeleteSession deleteSession(QTableModel table, QFieldModel field, JSONObject record, List<String> conditions) {
        return super.deleteSession(table, field, record, conditions);
    }
}
